package com.hctforgreen.greenservice.utils;

/**
 * 图片类型转换
 * 
 * @author Tallen Zhai
 * 
 */
public class MimeTypeUtil {
	public static String getMimeTypeByFileName(String name) {
		int lastIndexOf = name.lastIndexOf(".");
		String sub = name.substring(lastIndexOf + 1, name.length())
				.toLowerCase();
		if (sub.equals("jpg") || sub.equals("jpeg")) {
			return "image/jpeg";
		}
		if (sub.equals("png")) {
			return "image/png";
		}
		if (sub.equals("gif")) {
			return "image/gif";
		}

		if (sub.equals("mp4")) {
			return "video/mp4";
		}
		if (sub.equals("3gpp")) {
			return "video/3gpp";
		}
		return null;
	}
}
